package com.chushouya.controller.manager.api;

import com.chushouya.common.annotations.AuthValidate;
import com.chushouya.common.constant.ServiceType;
import com.chushouya.common.support.Contexts;
import com.general.framework.core.schema.Response;
import com.chushouya.manager.dto.api.setting.SettingItemDTO;
import com.chushouya.manager.service.api.SettingApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 设置接口控制器
 * 提供设置相关数据查询功能
 * 
 * @author chushouya
 */
@Api(tags = ServiceType.API + "设置接口数据")
@RestController
@RequestMapping(ServiceType.API + "/setting")
public class SettingApiController {

    @Resource
    private SettingApiService settingApiService;

    @AuthValidate
    @ApiOperation("获取设置列表数据")
    @GetMapping("/list")
    public Response<List<SettingItemDTO>> settingList() {
        final Long userId = Contexts.getUserContext().getUserId();
        List<SettingItemDTO> settingList = settingApiService.getSettingList(userId);
        return Response.success(settingList);
    }

}
